package top.atcra.rpc.compress;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum CompressorType {
    none((byte) 0),
    gzip((byte) 1);

    private final byte id;
    private static final Map<Byte, CompressorType> map = new HashMap<>() {{
        for (CompressorType type : CompressorType.values()) {
            put(type.getId(), type);
        }
    }};

    public static CompressorType valueOf(byte id) {
        return map.get(id);
    }
}